// The Vue build version to load with thecount : '0' `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import FastClick from 'fastclick'
import App from './App'
import router from './router/index'
//import ElementUI from 'element-ui'
//import 'element-ui/lib/theme-default/index.css'
//import axios from 'axios'
import Vuex from 'vuex'
// Vue.prototype.$axios = axios

// Vue.use(ElementUI)
Vue.use(Vuex)

//添加Fastclick移除移动端点击延迟
FastClick.attach(document.body)
Vue.config.productionTip = false

const store = new Vuex.Store({
	state: {
		cart: [
			{
				id: 2,
				src: require('./assets/newpro2.jpg'),
				title: '汽车除雪用品多功能可伸缩除雪铲 刮雪器清雪板车用除霜除冰铲子',
				link: '#/msg_product?msg=automobile&id=1',
				parameter: '黄色',
				selected: false,
				total: 180,
				num: 1
			},
		]
	},
	mutations: {
		upCart (state, list){
			state.cart.push(list);
		},
		delCart (state, index){
			state.cart.splice(index,1);
		}
	},
	actions: {
		update_cart (context, list){
			context.commit('upCart',list);
		},
		delate_cart (context, index){
			context.commit('delCart', index);
		}
	},
	getters: {
		getCart (state){
			return state.cart;
		}
	}
});

/* eslint-disable no-new */
new Vue({
  router,
  store,
  render: h => h(App),
}).$mount('#app-box');


////////////////////////////////////////////////////////////
// ajax() {                                       		  //
// 	this.$axios.get('/user?id=123').then(function (res){  //
// 		console.log(res);                         		  //
// 	}).catch(function (err){                      		  //
// 		console.log(err);                        		  //
// 	});                                          		  //
// } 													  //
//														  //
// AjaxPlugin：											  //
// this.$http.get('').then(({data}) => {                  //
//   console.log(data)							          //
// });                                                    //
///////////////////////////////////////////////////////////
